import app from '../app.js'

const roleInit = () => {

  // 角色列表
  app.get('/role', (req, res) => {
    res.send({
      code: 200,
      data: {
        data: [{
          id: 'R001',
          roleName: '系统管理员',
          access: 'HOME,USER,ROLE,PROJECTS',
          creator: 'admin',
          createdAt: '2024-06-29 15:00:00',
          updatedBy: 'admin',
          updatedAt: '2024-06-29 15:00:00'
        }],
        total: 5
      },
      msg: 'success'
    })
  });

  // 编辑角色信息
  app.put('/role', (req, res) => {
    res.send({
      code: 200,
      data: null,
      query: {
        info: req.body
      },
      msg: 'success'
    })
  });

  // 新增角色
  app.post('/role', (req, res) => {
    res.send({
      code: 200,
      data: null,
      query: {
        info: req.body
      },
      msg: 'success'
    })
  });

  // 删除角色
  app.delete('/role/:id', (req, res) => {
    res.send({
      code: 200,
      data: req.params,
      msg: 'success'
    })
  });
}

export default roleInit